<#include "../include/header.html">
<script type="text/javascript">
    var viewModel = Hap.createGridViewModel("#grid",{
      
        export: function () {
            exExcel();
        }
    });
</script>
<!--bug 描述 这里映入 <script></script> 的时候， 必须要成对标签出现，不能写成，<script /> 会导致页面解析出错-->
<script src="${base.contextPath}/common/code?HAP_OM_ORDER_STATUS=HAP_OM_ORDER_STATUS"
        type="text/javascript">
</script>

<body>

<div id="page-content">
    <!--页面上部分-->
    <div style="margin-top: 2%;margin-left: 1%"  id="header-from">
        <div class="row">
            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4" style="font-family:华文彩云"><@spring.message "OrderHeaders.companyId"/></label>
                    <div class="col-sm-8">
                        <input id='companyId' type="text" style="width: 100%;margin-left: 10px"
                               data-bind="value:model.companyId">
                        <script>
                            $("#companyId").kendoLov($.extend(<@lov "LOV_ORG_COMPANY"/>,{
                                textField: 'companyName',
                                model: viewModel.model
                            }));
                        </script>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4" style="font-family:华文彩云"><@spring.message "OrderHeaders.customerId"/></label>
                    <div class="col-sm-8">
                        <input id='customerId' type="text" style="width: 100%;margin-left: 10px"
                               data-bind="value:model.customerId">
                        <script>
                            /*1、未实现公司LOV没有选，客户LOV就不能选的场景
                            */
                                $("#customerId").kendoLov($.extend(<@lov "LOV_CUSTOMERS"/>,{
                                    query: function(e){
                                        e.param['companyId'] = $("#companyId").val();
                                    },
                                    textField: 'customerName',
                                    model: viewModel.model
                                }));
                        </script>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4" style="font-family:华文彩云"><@spring.message "OrderHeaders.orderNumber"/></label>
                    <div class="col-sm-8">
                        <input id='orderNumber' type="text" style="width: 100%;margin-left: 10px"
                               data-bind="value:model.orderNumber">
                    </div>
                </div>
            </div>
        </div>
        <!--上部分第二行-->
        <div class="row" style="margin-bottom: 3%;margin-top: 2%">
            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4" style="font-family: 华文彩云"><@spring.message "InvInventoryItems.inventoryItemId"/></label>
                    <div class="col-sm-8">
                        <input id='inventoryItemId' type="text" style="width: 100%;margin-left: 10px"
                               data-bind="value:model.inventoryItemId">
                        <script>
                            $("#inventoryItemId").kendoLov($.extend(<@lov "LOV_INV_ITEM"/>, {
                                textField: 'itemDescription',
                                model: viewModel.model
                            }));
                        </script>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4" style="font-family:华文彩云"><@spring.message "OrderHeaders.orderStatus"/></label>
                    <div class="col-sm-8">
                        <input id='orderStatus' type="text" style="width: 100%;margin-left: 10px"
                               data-bind="value:model.orderStatus">
                    </div>
                </div>
            </div>
        </div>

        <!--下面一部分-->
        <div style="padding-bottom:1%;margin-top: 1%">
        <!--第一行-->
        <div class="row" >
            <div class="col-sm-6" id="query-form">
                <!--查询按钮-->
                <div class="col-sm-2">
                   <span class="btn btn-primary" style="width:70px" data-bind="click:query" type="submit">
                       <i class="fa fa-search" style="margin-right: 3px;"></i><@spring.message "hap.query"/></span>
                </div>
                <!--重置按钮-->
                <div class="col-sm-2">
                   <span class="btn btn-default" style="width:70px" data-bind="click:reset" type="button">
                       <i class="fa fa-eraser" style="margin-right:3px;"></i><@spring.message "hap.reset"/></span>
                </div>
                <!--导出按钮-->
                <div class="col-sm-2">
                   <span class="btn btn-success" style="width:70px" data-bind="click:export" type="button">
                       <i class="fa fa-file-excel-o" style="margin-right:3px;"></i><@spring.message "hap.excel.export"/></span>
                </div>
        <span class="btn btn-primary  k-grid-excel" style="float:left;" onclick='Hap.importExcel("hap_om_order_headers")' >
            <i class="fa fa-arrow-circle-up" style="margin-right:3px;"></i>
            <@spring.message "excel.import"/>
        </span>
    </div>
</div>
        <!--第二行-->
        <div class="row" style="margin-top: 1%">
            <div class="col-sm-4">
                <div class="pull-left" id="toolbar-btn" style="padding-bottom:10px;">
            <span class="btn btn-primary k-grid-add" style="float:left;margin-right:5px;" data-bind="click:create">
                <i class="fa fa-plus-square" style="margin-right:3px;"></i><@spring.message "hap.new"/></span>
                </div>
            </div>
        </div>
    </div>
    </div>

    <script>kendo.bind($('#header-from'), viewModel);</script>
    <script>kendo.bind($('#toolbar-btn'), viewModel);</script>
    <script>kendo.bind($('#query-form'), viewModel);</script>

    <div style="clear:both">
        <div id="grid"></div>
    </div>
    <!--定义一个div装载弹窗-->
    <div id="dialog"></div>
</div>

<script type="text/javascript">
   

    //订单状态下拉框
    $("#orderStatus").kendoComboBox({
        dataSource: HAP_OM_ORDER_STATUS,
        valuePrimitive: true,
        dataTextField: "meaning",
        dataValueField: "value"
    });

   
    //倒数Excel
    function exExcel(){

        // var elemIF = document.createElement("iframe");
        // elemIF.src = "${base.contextPath}/hap/om/order/headers/export";
        // elemIF.style.display = "none";
        //document.body.appendChild(elemIF);

        var elemIF = document.createElement("iframe");
        elemIF.src = "${base.contextPath}/salary/excel/export";
        elemIF.style.display = "none";
        document.body.appendChild(elemIF);
     }

</script>
</body>
</html>

